"""modify tool

Revision ID: 5c3e36c42064
Revises: fd0b1e977e11
Create Date: 2025-04-20 21:37:11.630783

"""
from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa
from sqlalchemy.dialects import mysql

# revision identifiers, used by Alembic.
revision: str = '5c3e36c42064'
down_revision: Union[str, None] = 'fd0b1e977e11'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('ai_agents', 'system_prompt',
               existing_type=mysql.LONGTEXT(collation='utf8mb4_general_ci'),
               type_=sa.TEXT(length=16777216),
               existing_comment='系统提示词',
               existing_nullable=True)
    op.alter_column('funcall_log', 'log_text',
               existing_type=mysql.LONGTEXT(collation='utf8mb4_general_ci'),
               type_=sa.TEXT(length=16777216),
               existing_comment='日志信息',
               existing_nullable=True)
    op.alter_column('tools', 'tool_desc',
               existing_type=mysql.VARCHAR(collation='utf8mb4_general_ci', length=255),
               type_=sa.TEXT(length=16777216),
               nullable=True,
               existing_server_default=sa.text("''"))
    # ### end Alembic commands ###


def downgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.alter_column('tools', 'tool_desc',
               existing_type=sa.TEXT(length=16777216),
               type_=mysql.VARCHAR(collation='utf8mb4_general_ci', length=255),
               nullable=False,
               existing_server_default=sa.text("''"))
    op.alter_column('funcall_log', 'log_text',
               existing_type=sa.TEXT(length=16777216),
               type_=mysql.LONGTEXT(collation='utf8mb4_general_ci'),
               existing_comment='日志信息',
               existing_nullable=True)
    op.alter_column('ai_agents', 'system_prompt',
               existing_type=sa.TEXT(length=16777216),
               type_=mysql.LONGTEXT(collation='utf8mb4_general_ci'),
               existing_comment='系统提示词',
               existing_nullable=True)
    # ### end Alembic commands ###
